package com.ss.android.article.base.app.account;

import android.content.Context;
import android.text.TextUtils;

import com.ss.android.article.base.app.AppData;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public final class LoginDialogStrategyConfig {
    public Context a;
    public AppData b;
    public HashMap c;
    private boolean d;

    public LoginDialogStrategyConfig(Context arg2) {

        this.d = false;
        this.c = new HashMap();
        this.a = arg2.getApplicationContext();
    }

    private static void a(JSONObject arg8, Map arg9) {
        Iterator v2 = arg8.keys();
        while (v2.hasNext()) {
            Object v0 = v2.next();
            JSONObject v1 = arg8.optJSONObject(((String) v0));
            b v3 = new b();
            if (v1 != null) {
                v3.a = v1.optInt("action_type");
                JSONArray v4 = v1.optJSONArray("action_tick");
                if (v4 != null) {
                    int v5 = v4.length();
                    int[] v6 = new int[v5];
                    int v1_1;
                    for (v1_1 = 0; v1_1 < v5; ++v1_1) {
                        v6[v1_1] = v4.optInt(v1_1);
                    }

                    v3.b = v6;
                }
            }

            arg9.put(v0, v3);
        }
    }

    public final void a() {
        if (!this.d) {
            this.b = AppData.getInstance();
            String v0 = this.b.mLoginDialogStrategy;
            if (!TextUtils.isEmpty(v0)) {
                try {
                    JSONObject v0_2 = new JSONObject(v0).optJSONObject("favor");
                    if (v0_2 == null) {
                        this.d = true;
                        return;
                    }

                    LoginDialogStrategyConfig.a(v0_2, this.c);
                } catch (JSONException v0_1) {
                    v0_1.printStackTrace();
                }
            }

            label_15:
            this.d = true;
        }
    }

    @Retention(value = RetentionPolicy.SOURCE)
    public @interface LOGIN_DIALOG_SCENE {
    }

    @Retention(value = RetentionPolicy.SOURCE)
    public @interface LOGIN_DIALOG_SHOW {
    }
}

